package com.brkj.httpInterface;

import android.content.Context;
import com.brkj.model.DS_MyInfo;
import com.brkj.util.JsonUtil;
import com.brkj.util.MyApplication;
import com.brkj.util.view.BaseCoreActivity;

/**
 * Created by colin.ding on 2014/5/16.
 */
public class NomalResult{

    public static Boolean doResult(Object t, Context context){

        Result result =
                JsonUtil.fromJson((String) t, Result.class);

        if(result == null){
            ((BaseCoreActivity)context).showToast("未知错误！");
            return false;
        }

        if(result.result == 0){

            ((BaseCoreActivity)context).showToast(result.reason);

            return false;

        }else if(result.result == 1){

            return true;
        }

        return false;
    }

    public class Result{
        public  int result;
        public  String reason;
        public int getResult() {
            return result;
        }
        public void setResult(int result) {
            this.result = result;
        }
        public String getReason() {
            return reason;
        }
        public void setReason(String reason) {
            this.reason = reason;
        }

    }

}